package com.atguigu.service.eud_teacher.edu_subject.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.atguigu.service.eud_teacher.edu_subject.dao.CrmBannerDao;
import com.atguigu.service.eud_teacher.edu_subject.entity.CrmBannerEntity;
import com.atguigu.service.eud_teacher.edu_subject.service.CrmBannerService;

import java.util.List;


@Service("crmBannerService")
public class CrmBannerServiceImpl extends ServiceImpl<CrmBannerDao, CrmBannerEntity> implements CrmBannerService {

    @Autowired
    private CrmBannerDao crmBannerDao;

    @Cacheable(value="banner",key="'selectIndexList'")
    @Override
    public List<CrmBannerEntity> selectIndexList() {
        List<CrmBannerEntity> list= crmBannerDao.selectList
                (new QueryWrapper<CrmBannerEntity>()
                 .orderByDesc("id").last("limit 4"));
        return list;
    }

}